/**
 * 
 */
package database;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpSession;

import forum.Forum;
import forum.Member;
import forum.Post;

/**
 * @author Olga
 *
 */
public class DatabaseStub implements DatabaseInterface {

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#getFriends(javax.servlet.http.HttpSession)
	 */
	@Override
	public List<Member> getFriends(HttpSession session) {
		ArrayList<Member> friends = new ArrayList<Member>();
		friends.add(new Member("uname1", "fname1", "lname1","uname1@gmail.com","male"));
		friends.add(new Member("uname2", "fname2", "lname2","uname2@gmail.com","female"));
		friends.add(new Member("uname3", "fname3", "lname3","uname3@gmail.com","male"));
		return friends;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#addFriend(javax.servlet.http.HttpSession, java.lang.String)
	 */
	@Override
	public int addFriend(HttpSession session, String friendName) {
		System.out.println("friend with name "+friendName+"was added successfully");
		return 1;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#removeFriend(javax.servlet.http.HttpSession, java.lang.String)
	 */
	@Override
	public int removeFriend(HttpSession session, String friendName) {
		ArrayList<String> friends = new ArrayList<String>();
		friends.add("uname1");
		friends.add("uname2");
		friends.add("uname3");
		friends.remove(friendName);
		System.out.println("friend "+friendName+"was removed!!!");
		return 1;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#addUser(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, char)
	 */
	@Override
	public int addUser(String username, String firstName, String lastName,
			String password, String email, String gender) {
		System.out.println("user with this data: username = "+username+", firstName = "+firstName+", lastName = "+lastName+
				", password = "+password+", email = "+email+", gender = "+gender+" was added successfully");
		return 1;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#removeUser(java.lang.String)
	 */
	@Override
	public int removeUser(String username) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#login(java.lang.String, java.lang.String)
	 */
	@Override
	public int login(String username, String password) {
		// TODO Auto-generated method stub
		return 1;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#isModerator(java.lang.String)
	 */
	@Override
	public boolean isModerator(String username) {
		// TODO Auto-generated method stub
		return false;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#getForums()
	 */
	@Override
	public List<Forum> getForums() {
		List<Forum> ans = new ArrayList<Forum>();
		ans.add(new Forum(0, "subject 0"));
		ans.add(new Forum(1, "subject 1"));
		ans.add(new Forum(2, "subject 2"));
		ans.add(new Forum(3, "subject 3"));
		ans.add(new Forum(4, "subject 4"));
		ans.add(new Forum(5, "subject 5"));
		System.out.println("show list of forums from database");
		return ans;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#addForum(java.lang.String)
	 */
	@Override
	public int addForum(String subject) {
		List<Forum> ans = new ArrayList<Forum>();
		ans.add(new Forum(0, "subject 0"));
		ans.add(new Forum(1, "subject 1"));
		ans.add(new Forum(2, "subject 2"));
		ans.add(new Forum(3, "subject 3"));
		ans.add(new Forum(4, "subject 4"));
		ans.add(new Forum(5, "subject 5"));
		ans.add(new Forum(6, subject));
		System.out.println("forum addad to database");
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#removeForum(int)
	 */
	@Override
	public int removeForum(int forumID) {
		List<Forum> ans = new ArrayList<Forum>();
		ans.add(new Forum(0, "after remove subject 0"));
		ans.add(new Forum(1, "after remove subject 1"));
		ans.add(new Forum(2, "after remove subject 2"));
		ans.add(new Forum(3, "after remove subject 3"));
		ans.add(new Forum(4, "after remove subject 4"));
		System.out.println("forum removed from database");
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#getThreads(int)
	 */
	@Override
	public List<forum.Thread> getThreads(int ForumID) {
		System.out.println("get list of threads");
		List<forum.Thread>ans = new ArrayList<forum.Thread>();
		ans.add(new forum.Thread(0,"subject0","content0","username0"));
		ans.add(new forum.Thread(1,"subject1","content1","username1"));
		ans.add(new forum.Thread(2,"subject2","content2","username2"));
		return ans;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#addThread(java.lang.String, int, java.lang.String, java.lang.String)
	 */
	@Override
	public int addThread(String username, int ForumID,
			String subject, String content, String date) {
		List<forum.Thread>ans = new ArrayList<forum.Thread>();
		ans.add(new forum.Thread(0,"subject0","content0","username0"));
		ans.add(new forum.Thread(1,"subject1","content1","username1"));
		ans.add(new forum.Thread(2,"subject2","content2","username2"));
		System.out.println("add thread to databese");
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#removeThread(int, int, java.lang.String)
	 */
	@Override
	public int removeThread(int ThreadID) {
		List<forum.Thread>ans = new ArrayList<forum.Thread>();
		ans.add(new forum.Thread(0,"subject0","content0","username0"));
		ans.add(new forum.Thread(1,"subject1","content1","username1"));
		ans.add(new forum.Thread(2,"subject2","content2","username2"));
		System.out.println("removed thread from databese");
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#addPost(int, int, java.lang.String, java.lang.String, java.lang.String, int)
	 */
	@Override
	public int addReply(int PostIDreplyTo, String username,
			String subject, String content, String date) {
		System.out.println("post added to database");
		return 0;
	}

	/* (non-Javadoc)
	 * @see database.DatabaseInterface#removePost(int, int, int)
	 */
	@Override
	public int removeReply(int PostID) {
		System.out.println("post removed from database");
		return 0;
	}

	@Override
	public List<Post> getThread(int threadID) {
		Post p = new Post(0, "subject0", "content0", null, "", "username0" );
		List<Post> ans = new ArrayList<Post>();
		ans.add(p);
		ans.add(new Post(1,"subject1","content1",p,"", "username1"));
		return ans;
	}

	@Override
	public Post getPost(int PostID) {
		return new Post(0, "subject0", "content0", null, "", "username0" );

	}

	@Override
	public int editPost(int postID, String content) {
		System.out.println("post was edited in database");
		return 0;
	}

}
